07. Configure PX4

Now that we are familiar with QGroundControl and know how to connect to our drone, let's go ahead and check sensor calibrations and make some configuration changes to the PX4 autopilot.

Nd787 C1 L4 A05 L Configure PX4 1 V2

Configuring PX4

To recap configuring the PX4 autopilot, we:

  • checked to make sure all our sensors were calibrated and ran any calibrations required
  • checked to make sure our radio was properly calibrated and determined which switches control which channels
  • updated the battery settings to match the battery we are using
  • updated the flight control mode options to ensure we have the following options available:
    • Manual - most basic level of control, the drone will not maintain altitude or position automatically, will just stay level when no input is provided
    • Altitude - maintains current altitude
    • Position Control - uses GPS information to hold the drone in position when the pilot gives no inputs
    • Offboard - this is the mode in which we give control of the drone to our backyard flyer script
  • slowed down the flight speed when in Offboard mode by changing the following parameters:
    • MPC_XY_CRUISE - changed to 4 m/s
    • MPC_XY_VEL_MAX - changed to 5 m/s

Reminders for Fresh Install of PX4

If we've just updated your Intel Aero, or have reflashed a new version of PX4 onto our autopilot, we will need to make sure to complete the initial setup of your autopilot:

  • ensure sensors have all been calibrated
  • ensure remote control has been calibrated
  • ensure the values in the battery configuration match the battery you will be using

For Generic PX4 Autopilot

If we are working with a generic PX4 autopilot, PX4 is not by default set up to allow offboard control, so we will need to make sure to enable that. We can find the detailed instructions here, but in short, we will need to set the SYS_COMPANION parameter to the value 357600. This value tells the PX4 that offboard control will be coming over the normal telemetry link at a baud rate of 57600. For details on the options available for the parameter, we can look at PX4's documentation on the parameters.

Disclaimer

PLEASE REMEMBER THAT YOUR RIGHT TO USE ANY CODE PROVIDED BY UDACITY IS SUBJECT TO OUR TERMS OF USE, THE FLYING CAR SPECIAL TERMS, HONOR CODE, AND COMMUNITY CODE OF CONDUCT. TO THE EXTENT UDACITY PROVIDES YOU CODE TO USE IN CONNECTION WITH DEMONSTRATING FLYING DRONES AND/OR OTHER AUTONOMOUS FLYING VEHICLES, SUCH CODE IS PROVIDED “AS IS” WITH NO REPRESENTATIONS OR WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. YOU ASSUME TOTAL RESPONSIBILITY AND THE ENTIRE RISK FOR YOUR USE OF ANY CODE AND/OR OPERATION OF ANY AUTONOMOUS FLYING/UNMANNED VEHICLES. TO THE FULLEST EXTENT ALLOWED UNDER THE LAW, UDACITY DISCLAIMS ANY AND ALL LIABILITY RELATING TO YOUR USE OF ANY CODE OR YOUR OPERATION OF ANY UNMANNED AIRCRAFT OR FLYING VEHICLE AS SET FORTH IN THE TERMS OF USE, INCLUDING, BUT NOT LIMITED TO PROPERTY DAMAGE, PERSONAL INJURY, OR DEATH. TO THE EXTENT THAT YOU USE UDACITY’S CODE AND/OR YOUR OWN CODE FOR THE PURPOSES OF THIS COURSE, INCLUDING, BUT NOT LIMITED TO, USE CONNECTED WITH A FLYING DRONE, OR AS OTHERWISE ALLOWED BY UDACITY, SUCH USE BY YOU SHALL COMPLY WITH ALL FEDERAL, STATE, PROVINCIAL, AND/OR LOCAL LAWS REGARDING THE LICENSURE, REGISTRATION, AND OPERATION OF UNMANNED AIRCRAFT OR OTHER VEHICLES. FOR EXAMPLE, BUT NOT IN ANY WAY AS A LIMITATION, THE U.S. FEDERAL AVIATION ADMINISTRATION HAS SPECIFIC RULES RELATING TO THE OPERATION OF UNMANNED AIRCRAFT. THERE ARE ALSO PRIVACY REGULATIONS THAT MAY BE APPLICABLE TO YOUR USE OF THE CODE AND/OR OPERATION OF UNMANNED AIRCRAFT AND/OR VEHICLES AND ARE REQUIRED TO COMPLY WITH THOSE LAWS.